'''
This file is part of ModeliMark.

ModeliMark is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.

ModeliMark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with ModeliMark.
If not, see <http://www.gnu.org/licenses/>.

Copyright 2012 Jens Frenkel
'''

import os
import modelimark

# get compiler phat
OPENMODELICAHOME = os.environ.get('OPENMODELICAHOME')
omcpath = '%s/bin/omc.exe'%(OPENMODELICAHOME)

print omcpath

models=['Modelica.Blocks.Examples.BusUsage', \
'Modelica.Blocks.Examples.InverseModel', \
'Modelica.Blocks.Examples.LogicalNetwork1', \
'Modelica.Blocks.Examples.ShowLogicalSources', \
'Modelica.Electrical.Analog.Examples.CauerLowPassAnalog', \
'Modelica.Electrical.Analog.Examples.CauerLowPassOPV', \
'Modelica.Electrical.Analog.Examples.CauerLowPassSC', \
'Modelica.Electrical.Analog.Examples.ChuaCircuit', \
'Modelica.Electrical.Analog.Examples.NandGate', \
'Modelica.Electrical.Machines.Examples.TransformerTestbench', \
'Modelica.Mechanics.MultiBody.Examples.Elementary.DoublePendulum', \
'Modelica.Mechanics.MultiBody.Examples.Elementary.InitSpringConstant', \
'Modelica.Mechanics.MultiBody.Examples.Elementary.ForceAndTorque', \
'Modelica.Mechanics.MultiBody.Examples.Elementary.FreeBody', \
'Modelica.Mechanics.MultiBody.Examples.Elementary.Pendulum', \
'Modelica.Mechanics.MultiBody.Examples.Elementary.RollingWheelSetDriving', \
'Modelica.Mechanics.MultiBody.Examples.Elementary.RollingWheelSetPulling', \
'Modelica.Mechanics.MultiBody.Examples.Elementary.SpringMassSystem', \
'Modelica.Mechanics.MultiBody.Examples.Elementary.LineForceWithTwoMasses', \
'Modelica.Mechanics.MultiBody.Examples.Elementary.PointGravity', \
'Modelica.Mechanics.MultiBody.Examples.Elementary.PointGravityWithPointMasses', \
'Modelica.Mechanics.MultiBody.Examples.Elementary.RollingWheel', \
'Modelica.Mechanics.MultiBody.Examples.Elementary.SpringDamperSystem', \
'Modelica.Mechanics.MultiBody.Examples.Elementary.SpringWithMass', \
'Modelica.Mechanics.MultiBody.Examples.Loops.Engine1a', \
'Modelica.Mechanics.MultiBody.Examples.Loops.Engine1b_analytic', \
'Modelica.Mechanics.MultiBody.Examples.Loops.Fourbar_analytic', \
'Modelica.Mechanics.MultiBody.Examples.Loops.Fourbar1', \
'Modelica.Mechanics.MultiBody.Examples.Loops.Fourbar2', \
'Modelica.Mechanics.MultiBody.Examples.Loops.PlanarLoops_analytic', \
'Modelica.Mechanics.MultiBody.Examples.Rotational3DEffects.ActuatedDrive', \
'Modelica.Mechanics.MultiBody.Examples.Rotational3DEffects.GearConstraint', \
'Modelica.Mechanics.MultiBody.Examples.Rotational3DEffects.MovingActuatedDrive', \
'Modelica.Mechanics.Rotational.Examples.First', \
'Modelica.Mechanics.Rotational.Examples.FirstGrounded', \
'Modelica.Mechanics.Rotational.Examples.Friction', \
'Modelica.Mechanics.Rotational.Examples.Backlash', \
'Modelica.Mechanics.Rotational.Examples.LossyGearDemo1', \
'Modelica.Mechanics.Rotational.Examples.ElasticBearing', \
'Modelica.Mechanics.Rotational.Examples.RollingWheel', \
'Modelica.Mechanics.Translational.Examples.Accelerate', \
'Modelica.Mechanics.Translational.Examples.Brake', \
'Modelica.Mechanics.Translational.Examples.Damper', \
'Modelica.Mechanics.Translational.Examples.ElastoGap', \
'Modelica.Mechanics.Translational.Examples.Friction', \
'Modelica.Mechanics.Translational.Examples.InitialConditions', \
'Modelica.Mechanics.Translational.Examples.Oscillator', \
'Modelica.Mechanics.Translational.Examples.Sensors', \
'Modelica.Mechanics.Translational.Examples.SignConvention', \
'Modelica.Mechanics.Translational.Examples.WhyArrows', \
'Modelica.Thermal.FluidHeatFlow.Examples.OneMass']

models = ['Modelica.Blocks.Examples.BusUsage', \
'Modelica.Blocks.Examples.InverseModel', \
'Modelica.Blocks.Examples.LogicalNetwork1', \
'Modelica.Blocks.Examples.ShowLogicalSources', \
'Modelica.Electrical.Analog.Examples.CauerLowPassAnalog', \
'Modelica.Electrical.Analog.Examples.CauerLowPassOPV']

task = 'msl_3_1_omc'
print task
# workdir
workdir = '%s/%s'%(modelimark.settings.globalworkdir,task)

# model
model = modelimark.MSL('Modelica,{"3.1"}')
compiler = modelimark.OMC(omcpath)
bench = modelimark.BenchmarkComponent()
bench.runBenchmark(compiler, model, workdir, '%s.csv'%(task), models)
